﻿Public Class frmSingleBuilding
    Private m_Bldgi As New CAermod.Bldgi
    Property Bldgi() As CAermod.Bldgi
        Get
            Return Me.m_Bldgi
        End Get
        Set(ByVal value As CAermod.Bldgi)
            Me.m_Bldgi = value
        End Set
    End Property
    Public Sub New()

        ' 此调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        ' 在 InitializeComponent() 调用之后添加任何初始化。
        ReDim Me.m_Bldgi.ArryBuildTire(0)
        Me.m_Bldgi.ArryBuildTire(0) = New BuildTire
    End Sub
    Private Sub frmSingleBuilding_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.EFlexCoor.Styles.Alternate.BackColor = Color.FromArgb(216, 228, 248)

        Me.txtName.Text = Me.m_Bldgi.BuildName
        Me.txtBuildHight.Value = Me.m_Bldgi.BuildHight
        Me.txtTireHight.Value = Me.m_Bldgi.ArryBuildTire(0).TireHight
        Me.EFlexCoor.Rows.Count = Me.m_Bldgi.ArryBuildTire(0).ArryBuilCorner.Length + 1
        For i As Integer = 0 To Me.m_Bldgi.ArryBuildTire(0).ArryBuilCorner.Length - 1
            Me.EFlexCoor.SetData(i + 1, 0, i + 1)
            Me.EFlexCoor.SetData(i + 1, 1, Me.m_Bldgi.ArryBuildTire(0).ArryBuilCorner(i).x)
            Me.EFlexCoor.SetData(i + 1, 2, Me.m_Bldgi.ArryBuildTire(0).ArryBuilCorner(i).y)
        Next

        Me.EFlexCoor.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.EFlexCoor.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.None
        Me.EFlexCoor.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Me.m_Bldgi.BuildName = Me.txtName.Text
        Me.m_Bldgi.BuildHight = Me.txtBuildHight.Value
        Me.m_Bldgi.ArryBuildTire(0).TireHight = Me.txtTireHight.Value

        For i As Integer = 0 To Me.m_Bldgi.ArryBuildTire(0).ArryBuilCorner.Length - 1
            Me.m_Bldgi.ArryBuildTire(0).ArryBuilCorner(i).x = Me.EFlexCoor.GetData(i + 1, 1)
            Me.m_Bldgi.ArryBuildTire(0).ArryBuilCorner(i).y = Me.EFlexCoor.GetData(i + 1, 2)
        Next
        Me.DialogResult = Windows.Forms.DialogResult.OK
    End Sub

    Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
    End Sub
End Class